home *** CD-ROM | disk | FTP | other *** search
Wrap
function viewNumber(meter, num) { var _loc4_ = String(num); meter.gotoAndStop(_loc4_.length); var _loc1_ = 0; var _loc3_ = _loc4_.length - 1; while(_loc3_ >= 0) { meter["n" + _loc1_].gotoAndStop(Number(_loc4_.charAt(_loc3_)) + 1); meter["n" + _loc1_]._visible = true; _loc1_ = _loc1_ + 1; _loc3_ = _loc3_ - 1; } while(meter["n" + _loc1_] != undefined) { meter["n" + _loc1_].gotoAndStop(1); meter["n" + _loc1_]._visible = false; _loc1_ = _loc1_ + 1; } } function goTitle() { _quality = "BEST"; gotoAndStop("first"); GAMESTATE = "TITLE"; } function goHelp() { gotoAndStop("help"); GAMESTATE = "HELP"; } function showRanking(arg) { dataMode = arg; gotoAndStop("ranking"); GAMESTATE = "RANKING"; if(arg == 2) { _root.controll.removeMovieClip(); _root.controll2.removeMovieClip(); } } function startGame() { pauseMC.removeMovieClip(); _quality = "MIDIUM"; gotoAndStop("game"); initialize(); controll.swapDepths(1000); controll2.swapDepths(999); efx.swapDepths(1001); efx_extra.swapDepths(1002); efx_combo.swapDepths(1003); pauseMC.swapDepths(10000); } function initialize() { isPause = false; pauseMC._visible = false; controll2.avt1.gotoAndStop(1); controll2.avt2.gotoAndStop(1); controll2.avt3.gotoAndStop(1); controll2.avt4.gotoAndStop(1); bgm.stop(); bgm.attachSound("mainbgm"); bgm.start(0,999); alertmc.gotoAndStop(1); life = defaultLife; controll.groove.gage._x = controll.groove.gage._width / 100 * life - controll.groove.gage._width; score = 0; combo = 0; pspeed = 10; receivedPresent = -1; level = 1; speed = 8; createdPresent = 0; depth = 0; var _loc1_ = 0; while(_loc1_ < 5) { catchedPresent.shift(); _loc1_ = _loc1_ + 1; } onEnterFrame = loopFrame; GAMESTATE = "GAME"; PLAYERSTATE = "NORMAL"; startTime = getTimer(); } function finalize() { controll2.avt1.gotoAndStop(3); controll2.avt2.gotoAndStop(3); controll2.avt3.gotoAndStop(3); controll2.avt4.gotoAndStop(3); controll2.avt1.avt_mc.stop(); controll2.avt2.avt_mc.stop(); controll2.avt3.avt_mc.stop(); controll2.avt4.avt_mc.stop(); bgm.stop(); catchMiss(6); alertmc.gotoAndStop(2); onEnterFrame = null; GAMESTATE = "GAMEOVER"; } function returnPresent(who, where, presentType) { var _loc4_ = false; var _loc5_ = 0; var _loc3_ = 1; var _loc10_ = catchedPresent[catchedPresent.length - 1].presentType; var _loc9_ = catchedPresent[catchedPresent.length - 2].presentType; var _loc7_ = catchedPresent[catchedPresent.length - 3].presentType; var _loc8_ = catchedPresent[catchedPresent.length - 4].presentType; var _loc11_ = catchedPresent[catchedPresent.length - 5].presentType; if(_loc10_ == _loc9_ && _loc9_ == _loc7_ && _loc7_ == _loc10_) { _loc4_ = true; _loc5_ = 1; if(_loc8_ == _loc7_) { _loc5_ = 2; } if(_loc11_ == _loc8_) { _loc5_ = 3; } } if(_loc5_ == 0) { _loc3_ = 1; } else { _loc3_ = _loc5_ + 2; } var _loc2_ = 0; while(_loc2_ < _loc3_) { var _loc1_ = catchedPresent.pop(); if(_loc1_.presentType != undefined) { returnMotion(_loc1_,where,_loc1_.presentType,_loc4_); } _loc2_ = _loc2_ + 1; } } function returnMotion(who, where, presentType, isCombo) { efx_extra._x = who._x; efx_extra._y = who._y; efx_extra.gotoAndPlay(2); who.swapDepths(who.getDepth() + 1000); var _loc2_ = new mx.transitions.Tween(who,"_x",mx.transitions.easing.Regular.easeOut,who._x,25 + 100 * where,0.7,true); var _loc1_ = new mx.transitions.Tween(who,"_y",mx.transitions.easing.Regular.easeOut,who._y,400,0.7,true); _loc1_.onMotionChanged = function() { who._rotation += 10; }; _loc1_.onMotionFinished = function() { if(where < 5) { if(where == presentType + 1) { if(isCombo == true) { combo++; efx_combo._x = 25 + 100 * where; efx_combo._y = 320; viewNumber(efx_combo,combo); efx_combo.gotoAndPlay(1); } trace("콤보:" + combo); score += 100 + combo * 100; if(GAMESTATE == "GAME") { controll2["avt" + where].gotoAndStop(2); } } else { combo = 0; life -= 10; controll.groove.gage._x = controll.groove.gage._width / 100 * life - controll.groove.gage._width; score -= 100; if(GAMESTATE == "GAME") { controll2["avt" + where].gotoAndStop(3); } } } else if(where == 5) { if(presentType < 4) { combo = 0; life -= 10; controll.groove.gage._x = controll.groove.gage._width / 100 * life - controll.groove.gage._width; score -= 100; efx.gotoAndStop(2); efx._x = 500; efx._y = 400; efx.efx2.gotoAndPlay(2); } else { score += 100; efx.gotoAndStop(1); efx._x = 500; efx._y = 400; efx.efx1.gotoAndPlay(2); } if(GAMESTATE == "GAME") { controll2.avt5.gotoAndStop(2); } } who.removeMovieClip(); }; } function catchMiss(i) { life -= 10; controll.groove.gage._x = controll.groove.gage._width / 100 * life - controll.groove.gage._width; combo = 0; receivedPresent = -1; if(i > 5) { PLAYERSTATE = "MISS"; player.gotoAndStop(3); var _loc4_ = [-35 + player._x + random(70),player._x - 70 - random(140),player._x + 70 + random(140),player._x - 140 - random(210),player._x + 140 + random(210)]; i = 0; while(i < 5) { var _loc3_ = new mx.transitions.Tween(catchedPresent[i],"_x",mx.transitions.easing.Regular.easeOut,catchedPresent[i]._x,_loc4_[i],1.5,true); var _loc2_ = new mx.transitions.Tween(catchedPresent[i],"_y",mx.transitions.easing.Bounce.easeOut,catchedPresent[i]._y,400 - catchedPresent[i]._height,1.5,true); _loc2_.onMotionFinished = function() { catchedPresent[0].removeMovieClip(); catchedPresent.shift(); PLAYERSTATE = "NORMAL"; if(GAMESTATE == "GAME") { player.gotoAndStop(1); } }; i = i + 1; } life -= 100; } } function createPresent() { var _loc3_ = random(4); var _loc4_ = random(8); if(createdPresent % 10 == 0 && createdPresent > 0 && _loc4_ != 4) { _loc4_ = 4; } else if(_loc4_ == 4) { _loc4_ = random(4); } this.attachMovie("note","note" + depth,100 + depth,{presentType:_loc4_,channel:_loc3_}); var _loc2_ = this["note" + depth]; _loc2_._x = 100 + 100 * _loc3_; _loc2_.gotoAndStop(1 + _loc4_); depth++; if(depth > 50) { depth = 0; } _loc2_.PRESENTSTATE = "NORMAL"; _loc2_.onEnterFrame = function() { switch(PLAYERSTATE) { case "NORMAL": if(!isPause) { this._y += speed; if(this._y > 310 - catchedPresent.length * 40 - speed && this._y < 310 - catchedPresent.length * 40) { if(Math.abs(this._x - player._x) < 80) { if(catchedPresent.length >= 5) { catchMiss(6); } else { catchPresent(this); } } } if(this._y > 350) { catchMiss(0); this.removeMovieClip(); } } break; case "MISS": if(this.PRESENTSTATE === "NORMAL") { this.removeMovieClip(); } } }; createdPresent++; if(createdPresent == lvuptable[Math.min(3,level - 1)]) { level++; } } function catchPresent(presentobj) { receivedPresent = -1; delete presentobj.channel; presentobj.PRESENTSTATE = "CATCHED"; presentobj.onEnterFrame = null; catchedPresent.push(presentobj); presentobj.orderNumber = catchedPresent.length - 1; score += 10 + combo * 10; trace("llll"); presentobj.onEnterFrame = function() { if(PLAYERSTATE === "NORMAL") { if(!isPause) { this._x = player._x; this._y = 350 - 40 * (this.orderNumber + 1); } } }; } function loopFrame() { pauseMC._visible = isPause != true ? false : true; if(life <= 0) { finalize(); } else if(isPause == false) { currentTime = getTimer(); elapsedTime = currentTime - startTime; if(elapsedTime > delay[Math.min(3,level - 1)]) { createPresent(); startTime = getTimer(); } if(Key.isDown(37) && PLAYERSTATE == "NORMAL") { keyobj.pressed = false; player._x -= pspeed; if(player._x < 0) { player._x = 0; } player.gotoAndStop(2); } else if(Key.isDown(39) && PLAYERSTATE == "NORMAL") { keyobj.pressed = false; player._x += pspeed; if(player._x > 550) { player._x = 550; } player.gotoAndStop(2); } else if(PLAYERSTATE == "NORMAL") { player.gotoAndStop(1); } } } var GAMESTATE = "TITLE"; var PLAYERSTATE = "NORMAL"; var defaultLife = 100; var life; var score = 0; var combo; var depth = 0; var speed = 10; var pspeed = 18; var level = 1; var startTime; var currentTime; var elapsedTime; var isPause = false; var isSoundon = true; var createdPresent = 0; var catchedPresent = new Array(5); var delay = [2500,2000,1500,1000,750,500]; var lvuptable = [30,40,50,60,75,90]; var receivedPresent; var bgm = new Sound(this); var keyobj = new Object(); keyobj.pressed = false; keyobj.onKeyDown = function() { if(keyobj.pressed == false) { if(Key.isDown(80) && isPause == false) { isPause = true; pauseMC.gotoAndPlay(1); startTime = getTimer(); } else if(Key.isDown(80) && isPause == true) { isPause = false; startTime = getTimer(); } if(Key.isDown(83) && isSoundon == true) { isSoundon = false; bgm.setVolume(0); } else if(Key.isDown(83) && isSoundon == false) { isSoundon = true; bgm.setVolume(100); } if(Key.isDown(90) && catchedPresent.length > 0 && isPause == false) { returnPresent(catchedPresent[catchedPresent.length - 1],1,catchedPresent[catchedPresent.length - 1].presentType); controll2.avt1.key.gotoAndStop(2); } if(Key.isDown(88) && catchedPresent.length > 0 && isPause == false) { returnPresent(catchedPresent[catchedPresent.length - 1],2,catchedPresent[catchedPresent.length - 1].presentType); controll2.avt2.key.gotoAndStop(2); } if(Key.isDown(67) && catchedPresent.length > 0 && isPause == false) { returnPresent(catchedPresent[catchedPresent.length - 1],3,catchedPresent[catchedPresent.length - 1].presentType); controll2.avt3.key.gotoAndStop(2); } if(Key.isDown(86) && catchedPresent.length > 0 && isPause == false) { returnPresent(catchedPresent[catchedPresent.length - 1],4,catchedPresent[catchedPresent.length - 1].presentType); controll2.avt4.key.gotoAndStop(2); } if(Key.isDown(40) && catchedPresent.length > 0 && isPause == false) { returnPresent(catchedPresent[catchedPresent.length - 1],5,catchedPresent[catchedPresent.length - 1].presentType); controll2.avt5.key.gotoAndStop(2); } if(Key.isDown(32) && catchedPresent.length > 0 && catchedPresent[catchedPresent.length - 1].presentType == 4 && isPause == false) { var _loc1_ = new Array(0,0,0,0,1,1,1,1,1,1,2,2,3,3,3,3,3); var _loc2_ = _loc1_[random(_loc1_.length)]; switch(_loc2_) { case 0: life += 10; if(life > 100) { life = 100; } controll.groove.gage._x = controll.groove.gage._width / 100 * life - controll.groove.gage._width; efx.gotoAndStop(5); efx._x = catchedPresent[catchedPresent.length - 1]._x; efx._y = catchedPresent[catchedPresent.length - 1]._y; efx.efx5.gotoAndPlay(2); break; case 1: pspeed += 2; if(pspeed > 26) { pspeed = 26; } efx.gotoAndStop(4); efx._x = catchedPresent[catchedPresent.length - 1]._x; efx._y = catchedPresent[catchedPresent.length - 1]._y; efx.efx4.gotoAndPlay(2); break; case 2: pspeed -= 2; if(pspeed < 8) { pspeed = 8; } efx.gotoAndStop(7); efx._x = catchedPresent[catchedPresent.length - 1]._x; efx._y = catchedPresent[catchedPresent.length - 1]._y; efx.efx7.gotoAndPlay(2); break; case 3: score += 200; efx.gotoAndStop(6); efx._x = catchedPresent[catchedPresent.length - 1]._x; efx._y = catchedPresent[catchedPresent.length - 1]._y; efx.efx6.gotoAndPlay(2); } catchedPresent[catchedPresent.length - 1].removeMovieClip(); catchedPresent.pop(); } } if(!Key.isDown(37) || !Key.isDown(39)) { keyobj.pressed = true; } }; keyobj.onKeyUp = function() { controll2.avt1.key.gotoAndStop(1); controll2.avt2.key.gotoAndStop(1); controll2.avt3.key.gotoAndStop(1); controll2.avt4.key.gotoAndStop(1); controll2.avt5.key.gotoAndStop(1); keyobj.pressed = false; }; Key.addListener(keyobj); Array.prototype.shift2 = function(index) { var _loc3_ = this.length; this.splice(index,0); var _loc2_ = index; while(_loc2_ < _loc3_) { this[_loc2_] = this[_loc2_ + 1]; _loc2_ = _loc2_ + 1; } this.pop(); };